<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 炜杰
  Date: 2023/6/15
  Time: 8:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.jack.bookshop.vo.CategoryVo"%>
<%@ page import="com.jack.bookshop.dao.CategoryDao"%>
<%@ page import="java.util.List" %>
<%@ page isELIgnored="false" %>
<%
    int id1 = 1;
    List<CategoryVo> category1 = CategoryDao.getListByParentID(id1);
    int id2 = 2;
    List<CategoryVo> category2 = CategoryDao.getListByParentID(id2);
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Justin's Bookshop</title>
    <%@ include file="resource.jsp"%>
</head>
<body>
<%@ include file="header.jsp"%>
<div class="container" style="margin: 24px auto;">
    <div class="row">
        <div  id="main" class="col-md-12">
            <p>
                <a href="index.jsp">Home</a>
                >>
                <a href="category.jsp">Category</a>
            </p>
            <h3 class="text-center">Fiction</h3>
            <div class="row">
                <c:forEach var="element" items="<%=category1%>">
                    <div class="col-3 column-gap-3" style="margin: 3px 0px">
                        <a href="book.jsp?c2=${element.getId()}&page=1&size=2" class="btn btn-outline-primary">${element.getText()}</a>
                    </div>
                </c:forEach>
            </div>
            <h3 class="text-center">Non-Fiction</h3>
            <div class="row">
                <c:forEach var="element" items="<%=category2%>">
                    <div class="col-3 column-gap-3" style="margin: 3px 0px">
                        <a href="book.jsp?c2=${element.getId()}&page=1&size=2" class="btn btn-outline-primary">${element.getText()}</a>
                    </div>
                </c:forEach>
            </div>
        </div>
<%--        <div id="side" class="col-md-3">--%>
<%--            <%@ include file="sider.jsp"%>--%>
<%--        </div>--%>
    </div>
</div>
<%@ include file="footer.jsp"%>
</body>
</html>
